﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CardLogistics.Web.Components;
using System.Text;

namespace CardLogistics.Web.MainPage.CardArrival.StorageCheck
{
    public partial class StorageDetailedRpt : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
               string checkNo = Request.QueryString["checkNo"];//入库单号
               string checkId = Request.QueryString["checkId"];//入库单号ID
               string pconno = Request.QueryString["pconno"];//合同编号
               string batchno = Request.QueryString["batchno"];//批次号
               string startStorageDate = Request.QueryString["startStorageDate"];//入库开始时间
               string endStorageDate = Request.QueryString["endStorageDate"];//入库结束时间
               string ddlsupName = Request.QueryString["ddlsupName"];//供应商
          
            StringBuilder sbStr = new StringBuilder();
            sbStr.Append(" SELECT * FROM v_storage_detailed_card WHERE 1=1  ");
            sbStr.Append(" and CheckId ='" + checkId + "'"); //白卡入库单Id
            if (!string.IsNullOrEmpty(checkNo) && checkNo.Trim().Length > 0)
                sbStr.Append(" and CheckNo like '%" + checkNo.Trim().ToUpper() + "%' ");//入库单号
            if (!string.IsNullOrEmpty(pconno) && pconno.Trim().Length > 0)
                sbStr.Append(" and ConNo like '%" + pconno.Trim().ToUpper() + "%' ");//合同编号
            if (!string.IsNullOrEmpty(batchno) && batchno.Trim().Length > 0)
                sbStr.Append(" and BatchNo like '%" + batchno.Trim().ToUpper() + "%' ");//批次号

            if (!string.IsNullOrEmpty(ddlsupName) && ddlsupName != "0")
                sbStr.Append(" and SuppId='" + ddlsupName.Trim() + "'");//供应商
            if (!string.IsNullOrEmpty(startStorageDate) && startStorageDate.Trim().Length > 0)
                sbStr.Append(" and to_char(StorageDate,'yyyy-MM-dd')>='" + startStorageDate.Trim() + "'");//入库开始日期
            if (!string.IsNullOrEmpty(endStorageDate) && endStorageDate.Trim().Length > 0)
                sbStr.Append(" and to_char(StorageDate,'yyyy-MM-dd')<='" + endStorageDate.Trim() + "'");//入库结束日期
            sbStr.Append(" order by CheckNo");

            OracleXMLReportData.GenNodeXmlData(this, sbStr.ToString(), true);
        }
    }
}